Closed
Bug 1007049
Opened 11 years ago
Closed 9 years ago
Clang Static Analysis: Remove never read value to fix a minor warning found by scan-build.
Categories
(NSS :: Libraries, defect)
NSS
Libraries
Tracking
(Not tracked)
RESOLVED
DUPLICATE
of bug 1182667
People
(Reporter: sblin, Unassigned)
References
(Blocks 1 open bug)
Details
Attachments
(1 file)
3.50 KB,
patch
|
wtc
:
review-
|
Details | Diff | Splinter Review |
+++ This bug was initially created as a clone of Bug #1005652 +++
The attached patch fixes a warning detected by scan-build, the clang static analyzer.
Reporter | ||
Comment 1•11 years ago
|
||
Attachment #8418636 -
Flags: review?(kaie)
Reporter | ||
Updated•11 years ago
|
Blocks: clang-based-analysis
Updated•11 years ago
|
Attachment #8418636 -
Flags: review?(wtc)
Comment 2•11 years ago
|
||
Comment on attachment 8418636 [details] [diff] [review]
nss-minor-fix.diff
Thank you for the patch. This patch is wrong because the two
PK11_MakeString calls have side effect.
If the first argument is NULL and the second argument is not
NULL, PK11_MakeString copies the third argument to the
second argument and returns the second argument:
http://mxr.mozilla.org/nss/ident?i=PK11_MakeString
There are two ways to fix this.
1. Check that |tmp| is not NULL. As I explained above, this
check will never fail, so it is a useless check.
2. Ignore the return value of these two PK11_MakeString
calls. You can add a (void) cast to make the intention clear:
(void)PK11_MakeString(NULL,slot->slot_name,
...
Attachment #8418636 -
Flags: review?(wtc)
Attachment #8418636 -
Flags: review?(kaie)
Attachment #8418636 -
Flags: review-
Reporter | ||
Comment 3•11 years ago
|
||
Oops, sorry I forget the bug.
Thank you for the commentary.
I will work on it.
![]() |
||
Updated•11 years ago
|
Status: UNCONFIRMED → NEW
Ever confirmed: true
![]() |
||
Comment 4•9 years ago
|
||
Looks like this was fixed as part of Bug 1182667:
https://hg.mozilla.org/projects/nss/diff/0a59f0bce2ea/lib/pk11wrap/pk11slot.c#l1.33
Thanks for the patch anyways.
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → DUPLICATE
You need to log in
before you can comment on or make changes to this bug.
Description
•